package com.xiaoxin.urlshorter.controller;


import com.xiaoxin.urlshorter.DataDictionary.DataDictionaryItem;
import com.xiaoxin.urlshorter.utils.DataDictionaryUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@CrossOrigin
@RestController
public class UrlShorterController {

    @GetMapping("/hello")
    public String getShorterUrl() {
        return "hello";
    }

    @GetMapping("/dicts")
    public Object getDateDict(@RequestParam String dictCode) {
        HashMap<String, List<DataDictionaryItem>> dicMap = DataDictionaryUtils.getDictCode(dictCode);
        return dicMap;
    }
}
